package kr.saeildamil.androidstudy.exam;

import kr.saeildamil.androiddforstudy.R;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

public class NameCard_InflationEX extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.namecard_inflationex);

		Button btn = (Button) findViewById(R.id.btn_namecard_inf);
		
		btn.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				RelativeLayout relative = (RelativeLayout) View.inflate(
						NameCard_InflationEX.this, R.layout.namecard01, null);
				
				LinearLayout linear_name = (LinearLayout) findViewById(R.id.namecard_linear);
				
				if(linear_name.getChildCount()%2 ==0){
					relative.setBackgroundColor(Color.GRAY);
				}else{
					relative.setBackgroundColor(Color.DKGRAY);
				}
				linear_name.addView(relative);
			}
		});
	}
}
